package com.example.bms.serviceimpl;

import com.example.bms.entity.PaperManage;
import com.example.bms.mapper.PaperMapper;
import com.example.bms.service.PaperService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;


/**
 * @apiNote 用于实现对选择题增删改查
 * @author 任玥越
 * @email 3108289016@qq.com
 * @return ApiResult
 * @since 1.0.0
 */
@Service
@Transactional
public class PaperServiceImpl implements PaperService {

    @Autowired
    private PaperMapper paperMapper;


    /**
     * @apiNote 查询题库中所有试卷试题
     * @author 任玥越
     * @email 3108289016@qq.com
     * @return  List<PaperManage>
     * @since 1.0.0
     */
    @Override
    public List<PaperManage> findAll() {
        return paperMapper.findAll();
    }


    /**
     * @apiNote 查询对应试卷id的试题
     * @author 任玥越
     * @param paperId 试卷Id
     * @email 3108289016@qq.com
     * @return List<PaperManage>
     * @since 1.0.0
     */
    @Override
    public List<PaperManage> findById(Integer paperId) {
        return paperMapper.findById(paperId);
    }


    /**
     * @apiNote 增加试卷中的试题
     * @author 任玥越
     * @param paperManage 试题对象
     * @email 3108289016@qq.com
     * @return int类型，插入成功返回1，插入失败返回0
     * @since 1.0.0
     */
    @Override
    public int add(PaperManage paperManage) {
        return paperMapper.add(paperManage);
    }

}
